package com.oilsection.demo.controller;

import com.oilsection.demo.controller.req.JcdUpdateLocationReq;
import com.oilsection.demo.controller.req.JzUpdateLocationReq;
import com.oilsection.demo.po.Jcd;
import com.oilsection.demo.service.impl.JcdService;
import com.oilsection.demo.service.impl.JzService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

@RestController
@RequestMapping("/jcd")
@RequiredArgsConstructor
public class JcdController {

    private final JcdService jcdService;

    @PostMapping("/updateLocation")
    @CrossOrigin
    public String updateLocation(@RequestBody @Valid JcdUpdateLocationReq req) {
        jcdService.updateLocation(req);
        return "success";
    }

    @PostMapping("/list")
    @CrossOrigin
    public List<Jcd> list(@RequestBody Jcd jcd) {
        return jcdService.list(jcd);
    }
}
